#include <iostream>
//栈
#include <stack>
using namespace std;

int a=0;
void JudgementStack(stack<char> a);
int main(){
    stack<char> s;
    stack<char> k;
    cin>>a;
    JudgementStack(s);
    for(int i=0;i<a;i++){
        char b;
        cin>>b;
        s.push(b);
        k.push(b);
    }
    JudgementStack(s);
    cout<<s.size()<<endl;
    for(int i=0;i<a;i++){
        cout<<s.top()<<" ";
        s.pop();
    }
    cout<<endl;
    for(int i=0;i<a;i++){
        cout<<k.top()<<" ";
        k.pop();
    }
    cout<<endl;
    JudgementStack(s);
    return 0;

    

}
void JudgementStack(stack<char> a){
    if(a.empty()) cout<<"yes"<<endl;
    else cout<<"no"<<endl;
}